<%@ page import="report.Activity" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title>iPET - Atividades</title>
    </head>
    <body>
        <g:render template="/common/menuActivity" />
        <div id="text">
        <div class="body">
			<h2>Criar atividade</h2>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${activityInstance}">
            <div class="errors">
                <g:renderErrors bean="${activityInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="nature"><g:message code="activity.nature.label" default="Natureza" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'nature', 'errors')}">
                                    <g:textField name="nature" maxlength="128" value="${activityInstance?.nature}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="theme"><g:message code="activity.theme.label" default="Tema" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'theme', 'errors')}">
                                    <g:textField name="theme" maxlength="128" value="${activityInstance?.theme}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="type"><g:message code="activity.type.label" default="Tipo" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'type', 'errors')}">
                                    <g:select name="type" from="${['Ensino', 'Extensão', 'Pesquisa', 'Coletiva']}" value="${activityInstance?.type}"  />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="months"><g:message code="activity.months.label" default="Meses" /></label>
                                </td>
                                 <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'months', 'errors')}">
                                    <input type="checkbox" name="months" value="Janeiro" />Janeiro
                                    <input type="checkbox" name="months" value="Fevereiro" />Fevereiro
                                    <input type="checkbox" name="months" value="Março" />Março
                                    <input type="checkbox" name="months" value="Abril" />Abril
                                    <input type="checkbox" name="months" value="Maio" />Maio
                                    <input type="checkbox" name="months" value="Junho" />Junho
                                    <input type="checkbox" name="months" value="Julho" />Julho <br />
                                    <input type="checkbox" name="months" value="Agosto" />Agosto
                                    <input type="checkbox" name="months" value="Setembro" />Setembro
                                    <input type="checkbox" name="months" value="Outubro" />Outubro
                                    <input type="checkbox" name="months" value="Novembro" />Novembro
                                    <input type="checkbox" name="months" value="Dezembro" />Dezembro
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="startDate"><g:message code="activity.startDate.label" default="Início" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'startDate', 'errors')}">
                                    <g:datePicker name="startDate" precision="day" value="${activityInstance?.startDate}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="endDate"><g:message code="activity.end.label" default="Fim" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'endDate', 'errors')}">
                                    <g:datePicker name="endDate" precision="day" value="${activityInstance?.endDate}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description"><g:message code="activity.description.label" default="Descri&ccedil;&atilde;o" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'description', 'errors')}">
                                    <g:textArea name="description" value="${activityInstance?.description}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="target"><g:message code="activity.target.label" default="P&uacute;blico Alvo" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'target', 'errors')}">
                                    <g:textArea name="target" value="${activityInstance?.target}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="reasons"><g:message code="activity.reasons.label" default="Justificativa" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'reasons', 'errors')}">
                                    <g:textArea name="reasons" value="${activityInstance?.reasons}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="expectedResults"><g:message code="activity.expectedResults.label" default="Resultados Esperados" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'expectedResults', 'errors')}">
                                   <g:textArea name="expectedResults" value="${activityInstance?.expectedResults}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="actualResults"><g:message code="activity.actualResults.label" default="Resultados Obtidos" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'actualResults', 'errors')}">
                                    <g:textArea name="actualResults" value="${activityInstance?.actualResults}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="partners"><g:message code="activity.partners.label" default="Colaboradores" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'partners', 'errors')}">
                                    <g:textArea name="partners" value="${activityInstance?.partners}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="sponsor"><g:message code="activity.sponsor.label" default="Respons&aacute;vel" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'sponsors', 'errors')}">
                                    <div class="selects">
	                                    <g:select class="from" from="${user.User.list()}" optionKey="id" optionValue="nome" multiple="multiple" />
	                                    <g:select class="to" name="sponsors" optionKey="id" optionValue="nome" multiple="multiple" />
	                                    <a href="#" id="to" onclick="return false"><img alt="Edit" src="${resource(dir:'images/icons',file:'to.png')}" /></a> <br />
	                                    <a href="#" id="from" onclick="return false"><img alt="Edit" src="${resource(dir:'images/icons',file:'from.png')}" /></a>
                                    </div>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="comments"><g:message code="activity.comments.label" default="Comentários Gerais" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'comments', 'errors')}">
                                	<g:textArea name="comments" value="${activityInstance?.comments}" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="Criar" /></span>
                </div>
            </g:form>
            <br /><br />
        </div>
        </div>
    </body>
</html>
